<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.thymeleaf.org/thymeleaf-extras-shiro">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>设备种类</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico">
    <link th:href="@{static/css/bootstrap.min.css}" href="../static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link th:href="@{static/css/font-awesome.css}" href="../static/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link th:href="@{static/css/plugins/iCheck/custom.css}" href="../static/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link th:href="@{static/css/animate.css}" href="../static/css/animate.css" rel="stylesheet">
    <link th:href="@{static/css/style.css}" href="../static/css/style.css?v=4.1.0" rel="stylesheet">
    <link th:href="@{static/css/plugins/sweetalert/sweetalert.css}" href="../static/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
</head>

<body class="gray-bg">

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>设备种类列表</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <form method="post" th:action="@{category_list}">
                                <div class="col-sm-3">
                                    <div class="input-group">
                                        <input type="text" placeholder="请输入关键字" th:value="${query.type}" name="name" class="form-control">
                                        <span
                                            class="input-group-btn">
                                        <button type="submit" class="btn btn-info">搜索</button>
                                        </span>
                                    </div>
                                </div>
                            </form>
                            <button shiro:hasPermission="1" type="button" class="btn btn-info" data-toggle="modal"
                                    data-target="#addApartmentModal">
                                添加种类
                            </button>
                        </div>
                        <div class="table-responsive">
                            <table th:switch="${pageBean.list ne null and pageBean.list.size() gt 0}"
                                    class="table table-striped">
                                <thead>

                                <tr>
                                    <th>ID</th>
                                    <th>设备种类</th>
                                    <th shiro:hasPermission="1">操作</th>
                                </tr>
                                </thead>
                                <tbody th:case="true">
                                <tr th:each="item:${pageBean.list}">
                                    <td th:text="${item.id}">1</td>
                                    <td th:text="${item.type}">蓝溪郡</td>
                                    <td>
                                        <button shiro:hasPermission="1"class="btn btn-xs btn-primary" th:onclick="|deleteCategory(${item.id})|">删除</button>
                                        <button shiro:hasPermission="1"class="btn btn-xs btn-danger"
                                                data-toggle="modal"
                                                data-target="#updateApartmentModal" th:onclick="|toupdatecategory(${item.id})|">更新</button>
                                    </td>
                                </tr>
                                <tbody th:case="false">
                                <tr>
                                    <td>暂无数据</td>
                                    <td>暂无数据</td>
                                    <td>暂无数据</td>
                                </tr>
                                </tbody>
                                </tbody>
                            </table>
                            <div class="pull-right">
                                <script type="text/javascript">
                                    function page(currentPage) {
                                        window.location.href = getRootPath() + "/category_list?currentPage="
                                            + currentPage;
                                    }
                                </script>
                                <div class="pull-right" th:replace="share/page :: page">
                                    <ul class="pagination">
                                        <li>
                                            <a href="#" aria-label="Previous">
                                                <span aria-hidden="true">&laquo;</span>
                                            </a>
                                        </li>
                                        <li><a href="#">1</a></li>
                                        <li><a href="#">2</a></li>
                                        <li><a href="#">3</a></li>
                                        <li><a href="#">4</a></li>
                                        <li><a href="#">5</a></li>
                                        <li>
                                            <a href="#" aria-label="Next">
                                                <span aria-hidden="true">&raquo;</span>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--添加-->
<div class="modal inmodal" id="addApartmentModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated fadeIn">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h6 class="modal-title">添加设备种类</h6>
            </div>
            <div class="modal-body col-sm-12">
                <form class="form-horizontal" method="post" onsubmit="return addCategory(this)" >
                    <div class="form-group">
                        <label class="col-sm-2 control-label">设备种类名称</label>
                        <div class="col-sm-10">
                            <input type="text" placeholder="请输入设备种类名称" class="form-control" name="typename" id="typename">
                        </div>
                    </div>

                    <div class="modal-footer">
                        <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                        <button type="submit" class="btn btn-primary" >保存</button>
                    </div>
                </form>
            </div>

        </div>
    </div>
</div>
<!--更新-->
<div class="modal inmodal" id="updateApartmentModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated fadeIn">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h6 class="modal-title">更新设备种类</h6>
            </div>
            <div class="modal-body col-sm-12">
                <form class="form-horizontal" method="post" onsubmit="return updateCategory(this)">
                    <div class="form-group">
                        <div class="col-sm-10">
                            <input type="hidden" id="id" name="id" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">设备种类名称</label>
                        <div class="col-sm-10">
                            <input type="text" placeholder="请输入设备种类名称" class="form-control" id="typename2" name="typename2">
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                        <button type="submit" class="btn btn-primary" >保存</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>



<!-- 全局js -->
<script th:src="@{static/js/jquery.min.js}" src="../static/js/jquery.min.js?v=2.1.4"></script>
<script th:src="@{static/js/bootstrap.min.js}" src="../static/js/bootstrap.min.js?v=3.3.6"></script>


<!-- Peity -->
<script th:src="@{static/js/plugins/peity/jquery.peity.min.js}" src="../static/js/plugins/peity/jquery.peity.min.js"></script>

<!-- 自定义js -->
<script th:src="@{static/js/content.js}" src="../static/js/content.js?v=1.0.0"></script>


<!-- iCheck -->
<script th:src="@{static/js/plugins/iCheck/icheck.min.js}" src="../static/js/plugins/iCheck/icheck.min.js"></script>

<script th:src="@{static/script/base.js}" src="../static/script/base.js"></script>

<script th:src="@{static/script/tips.js}" src="../static/script/tips.js"></script>

<script th:src="@{static/script/category.js}" src="../static/script/category.js"></script>

<script th:src="@{static/js/plugins/sweetalert/sweetalert.min.js}" src="../static/js/plugins/sweetalert/sweetalert.min.js"></script>

<!-- Peity -->
<!--<script src="../static/js/demo/peity-demo.js"></script>-->

</body>
</html>
